Auto merge of #2406 - alexcrichton:download-less, r=brson
authorbors <bors@rust-lang.org>
Mon, 29 Feb 2016 19:32:24 +0000 (19:32 +0000)
committerbors <bors@rust-lang.org>
Mon, 29 Feb 2016 19:32:24 +0000 (19:32 +0000)
commit8fc3fd8df3857f3e77454c992458cd7baeeb622b
tree890f2c174c3a65cb2fa155c6ab305110708cb800
parent582dcb7eb2ad04c71e3d9b28dd84abf5c5779b22
parentf9945926ebe70e4c1bb122bdb03f6336036cb9cf
Auto merge of #2406 - alexcrichton:download-less, r=brson

Currently Cargo will download an entire resolution graph all at once when in fact most packages may not be relevant to a compilation. For example target-specific dependencies and dev-dependencies are unconditionally downloaded regardless of whether they're actually needed or not.

This commit alters the internals of Cargo to avoid downloading everything immediately and just switches to lazily downloading packages. This involved adding a new `LazyCell` primitive (similar to the one in use on crates.io) and also propagates `CargoResult` in a few more locations.

Overall this ended up being a pretty large refactoring so the commits are separated in bite-sized chunks as much as possible with the end goal being this PR itself.

Closes #2394
src/cargo/ops/cargo_compile.rs
src/cargo/ops/cargo_install.rs